cmake_minimum_required(VERSION 3.8)
project(addcustomcommand_build_events)
#add_library(hello STATIC hello.cpp)

#include_directories(${PROJECT_SOURCE_DIR})
#add_executable(main main.cpp)
#add_custom_command(TARGET main PRE_BUILD COMMAND echo "pre build...")
#add_custom_command(TARGET main PRE_LINK COMMAND echo "pre link...")
#add_custom_command(TARGET main POST_BUILD COMMAND echo "post build..." COMMAND cp ${PROJECT_SOURCE_DIR}/doc.txt ${PROJECT_BINARY_DIR}/doc.txt)
#add_custom_command(TARGET main PRE_BUILD COMMAND echo "pre build..." COMMAND cp ${PROJECT_SOURCE_DIR}/libhello.a ${PROJECT_BINARY_DIR}/libhello.a)
#add_custom_command(TARGET main PRE_LINK COMMAND echo "pre build..." COMMAND cp ${PROJECT_SOURCE_DIR}/libhello.a ${PROJECT_BINARY_DIR}/libhello.a)

#target_link_libraries(main ${PROJECT_BINARY_DIR}/libhello.a)

add_custom_target(target COMMAND echo "target...")
add_custom_command(TARGET target PRE_BUILD COMMAND echo "pre build...")
add_custom_command(TARGET target PRE_LINK COMMAND echo "pre link...")
add_custom_command(TARGET target POST_BUILD COMMAND echo "post build...")
